# Author:Yiye
# -*- codeing = utf-8 -*-
# @Time :2021/11/11 10:37
# @Author:李卓
# @Site : 
# @File : __init__.py.py
# @Software : PyCharm
import urllib.request
import redis
#pool = redis.ConnectionPool(host='47.94.155.194', port=6379, decode_responses=True)
#r = redis.Redis(host='47.94.155.194', port=6379, password='java_redis_dev@password',decode_responses=True)
#r = redis.StrictRedis(host='47.94.155.194', port=6379, password='123456')
#r.set('name', 'runoob')  # 设置 name 对应的值
#print(r.get('name'))  # 取出键 name 对应的值

url = 'https://www.baidu.com'

response = urllib.request.urlopen(url)
content = response.read().decode('utf-8')
print(content)
#r.set('baidu.com',content)
# print(content)
#print(str)

headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36'
}

request = urllib.request.Request(url=url,headers=headers)
response = urllib.request.urlopen(request)
content = response.read().decode('utf8')
print(content)